<template>
	<view class="information-list" v-if="list">
		<uni-swipe-action v-if="list.length > 0">
			<uni-swipe-action-item  v-for="(item,index) in list" :key="index">
				<view class="item"  @click="toView(item)">
					<div class="item-l">
						<image mode="aspectFill" src="../../../static/img/headFeature/member/archivedOne.png"></image>
						<text>{{item.healthName}}</text>
					</div>
					<div class="item-c">
						<p v-if="item.type == 1">双向转诊 (转出) 单</p>
						<p v-if="item.type == 2">双向转诊 (回转) 单</p>
						<p>转诊编号：{{!item.status || item.status == 1?'未存档':item.sn}}</p>
						<p>{{!item.status || item.status == 1?'存档时间：未存档':'转诊时间：'+item.referralDate}}</p>
					</div>
					<div :class="['item-r',!item.status || item.status == 1?'not-archived':'archived']">{{!item.status || item.status == '未存档'?'未存档':'已存档'}}</div>
				</view>
			</uni-swipe-action-item>
		</uni-swipe-action>
		<view class="noneChating" v-if="list.length <= 0">
			<image src="../../../static/img/headFeature/chattingNone.png"></image>
			<view>暂无数据</view>
		</view>
	</view>
</template>

<script>
	import {filterData2,getUrlParam} from '@/static/js/filter.js';
	export default{
		data(){
			return {
				pageIndex: 1,
				pageSize: 20,
				list: null,
				userId: '',
			}
		},
		onLoad(){
			this.userId = getUrlParam('userId');
			this.getlist()
		},
		methods:{
			filterData2,
			getlist(){
				this.$api.userReferralList({pageIndex:this.pageIndex,pageSize:this.pageSize,userId:this.userId}).then((res)=>{
					this.list = res.data.result.elements;
				})
			},
			toView(e) {
			    if(e.type == 1) {
			    	uni.navigateTo({
			    		url:'/pages/headFeatures/userReferral/toView?id='+e.id
			    	})
			    } else {
			    	uni.navigateTo({
			    		url:'/pages/headFeatures/userReferral/toView1?id='+e.id
			    	})
			    }

			}

		}
	}
</script>

<style lang="scss" scoped>
	.information-list{
		min-height: calc(100vh - 88upx);
		background: #F8F8F8;
		.uni-swipe{
			margin-bottom: 24upx;
		}
		.item{
			display: flex;
			padding: 42upx 21upx;
			background: #fff;
			width: 100%;
			&-l{
				position: relative;
				image{
					width: 92upx;
					height: 106upx;
					margin-right: 48upx;
					margin-top: 10upx;
				}
				text {
					width: 92upx;
					position: absolute;
					bottom: 16upx;
					color: #FFFFFF;
					font-size: 18upx;
					left: 0;
					overflow: hidden;    
					text-overflow:ellipsis;    
					white-space: nowrap;
					display: block;
					text-align: center;
				}
			}
			&-c{
				flex:1;
				font-size: 28upx;
				line-height: 1.5;
				&:nth-of-type(1){
					font-weight: bold;
					font-size: 30upx;
				}
			}
			&-r{
				font-size: 26upx;
				&.not-archived{
					color: #1A85E9;
				}
				&.archived{
					color: #38CB97;
				}
			}
		}
		.noneChating {
			padding-top: 228upx;
			image {
				display: block;
				margin: 0 auto;
				width: 260upx;
				height: 154upx;
			}
			view {
				margin: 24px auto;
				text-align: center;
				color: #333333;
				font-size: 13px;
			}
		}
	}
</style>
